<?php
$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");


//在Student表增加学生记录('花木兰', '2', '2000-10-11', '福建省龙岩市永定区', '2')
$insertSql = "INSERT INTO [dbo].[Student]
           ([StudentName]
           ,[StudentSex]
           ,[StudentBirth]
           ,[StudentAddress]
           ,[ClassId])
     VALUES
           ('花木兰', '2', '2000-10-11', '福建省龙岩市永定区', '2')";
$result = $db->exec($insertSql);
var_dump($result);
if ($result) {
    echo "插入成功，影响行数：" . $result;
} else {
    echo "插入失败";
}